package com.bigstonecontainer.training.springboot.frm.server.core.exception;

import com.bigstonecontainer.training.springboot.frm.server.core.domain.Result;
import lombok.Data;

@Data
public class FrmServerException extends RuntimeException {

    private Result result;

    public FrmServerException(Result result) {
        super(result.getMsg());
        this.result = result;
    }

    public FrmServerException(Result result, Throwable cause) {
        super(result.getMsg(), cause);
        this.result = result;
    }

    public FrmServerException(String message, Throwable cause) {
        super(message, cause);
        this.result = Result.error(message);
    }

    public FrmServerException(int httpStatus, String message, Throwable cause) {
        super(message, cause);
        this.result = Result.error(httpStatus, message);
    }
}
